/**
 * Licensee: Carla Painemilla
 * License Type: Evaluation
 */
package ormsamples;

import org.orm.*;
public class ListDiagnosticoData {
	private static final int ROW_COUNT = 100;
	
public void listTestData() throws PersistentException {
		orm.DAOFactory lDAOFactory = orm.DAOFactory.getDAOFactory();
		System.out.println("Listing Curso...");
		orm.Curso[] oRMCursos = lDAOFactory.getCursoDAO().listCursoByQuery(null, null);
		int length = Math.min(oRMCursos.length, ROW_COUNT);
		for (int i = 0; i < length; i++) {
			System.out.println(oRMCursos[i]);
		}
		System.out.println(length + " record(s) retrieved.");
		
		System.out.println("Listing Alumno...");
		orm.Alumno[] oRMAlumnos = lDAOFactory.getAlumnoDAO().listAlumnoByQuery(null, null);
		length = Math.min(oRMAlumnos.length, ROW_COUNT);
		for (int i = 0; i < length; i++) {
			System.out.println(oRMAlumnos[i]);
		}
		System.out.println(length + " record(s) retrieved.");
		
		System.out.println("Listing Anotacion...");
		orm.Anotacion[] oRMAnotacions = lDAOFactory.getAnotacionDAO().listAnotacionByQuery(null, null);
		length = Math.min(oRMAnotacions.length, ROW_COUNT);
		for (int i = 0; i < length; i++) {
			System.out.println(oRMAnotacions[i]);
		}
		System.out.println(length + " record(s) retrieved.");
		
		System.out.println("Listing Anotador...");
		orm.Anotador[] oRMAnotadors = lDAOFactory.getAnotadorDAO().listAnotadorByQuery(null, null);
		length = Math.min(oRMAnotadors.length, ROW_COUNT);
		for (int i = 0; i < length; i++) {
			System.out.println(oRMAnotadors[i]);
		}
		System.out.println(length + " record(s) retrieved.");
		
		System.out.println("Listing Tipo...");
		orm.Tipo[] oRMTipos = lDAOFactory.getTipoDAO().listTipoByQuery(null, null);
		length = Math.min(oRMTipos.length, ROW_COUNT);
		for (int i = 0; i < length; i++) {
			System.out.println(oRMTipos[i]);
		}
		System.out.println(length + " record(s) retrieved.");
		
		System.out.println("Listing Subsector...");
		orm.Subsector[] oRMSubsectors = lDAOFactory.getSubsectorDAO().listSubsectorByQuery(null, null);
		length = Math.min(oRMSubsectors.length, ROW_COUNT);
		for (int i = 0; i < length; i++) {
			System.out.println(oRMSubsectors[i]);
		}
		System.out.println(length + " record(s) retrieved.");
		
	}
	
	public static void main(String[] args) {
		try {
			ListDiagnosticoData listDiagnosticoData = new ListDiagnosticoData();
			try {
				listDiagnosticoData.listTestData();
			}
			finally {
				orm.DiagnosticoPersistentManager.instance().disposePersistentManager();
			}
		}
		catch (Exception e) {
			e.printStackTrace();
		}
	}
}
